import gtk

class DlgDirectorySelection:
    def __init__( self, title):
        self.__dirName = ""
        self.__dlg = gtk.FileChooserDialog( title
                                          , None
                                          , gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER
                                          , (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                             gtk.STOCK_OK, gtk.RESPONSE_OK))

    def getDirSelected( self):
        response = self.__dlg.run()
        dirname = ""
        if response == gtk.RESPONSE_OK:
            dirname = self.__dlg.get_filename()
        self.__dlg.destroy()
        return dirname

